Array.prototype.fill2=function (value,start,end){
    if(start<0){
        start=start+this.length
        if(start<0){
            start=0
        }
    }
    if(start>=this.length){
        return this
    }
    if(end<0){
        end=end+this.length
        if(end<0){
            end=0
        }
    }
    if(end>this.length){
        end=this.length
    }

    for(let i=(start||0);i<(end||this.length);i++){
        this[i]=value
    }
    
    return  this

}
let arr=[1,3,4,6,7]
let a=arr.fill2(0,6,-9)
let b=arr.fill(0,6,-9)
console.log(a,'--a');
console.log(b,'--b');